
//
//  tableVC.m
//  timer
//
//  Created by MyMac on 15/8/12.
//  Copyright (c) 2015年 MyMac. All rights reserved.
//

#import "tableVC.h"
#import "TempTimertager.h"
#import "Avc.h"
@interface tableVC()
@property(nonatomic,strong)NSTimer*timer;
@end
@implementation tableVC
-(void)viewDidLoad
{
    

self.title=@"22222";
    self.timer=[TempTimertager scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(refresh) userInfo:nil repeats:YES];
    NSLog(@"%@",self.timer);
    UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(next)];
    [self.view addGestureRecognizer:tap];






}
-(void)next
{
    Avc*a=[[Avc alloc]init];

    [self.navigationController pushViewController:a animated:YES];

}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.timer setFireDate:[NSDate distantPast]];//调用此方法时，定时器会立刻执行一次,不会等到时间点再调



}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self.timer setFireDate:[NSDate distantFuture]];

}
-(void)refresh
{
    static int i=0;
    NSLog(@"%ld",(long)i++);

}
@end
